var str = 'hello html hello js hello css'
// 没有开启全局匹配 没有lastIndex这个属性的 每次校验都会回到其实位置 0 重新匹配
var reg1 = /hello/
// 开启全局匹配模式
var reg2 = /hello/g

// console.log(reg1.lastIndex);
// console.log(reg1.exec(str));
// console.log(reg1.lastIndex);

// console.log(reg1.lastIndex);
// console.log(reg1.exec(str));
// console.log(reg1.lastIndex);

console.log(reg2.lastIndex);
console.log(reg2.exec(str));
console.log(reg2.lastIndex);

console.log(reg2.lastIndex);
console.log(reg2.exec(str));
console.log(reg2.lastIndex);

console.log(reg2.lastIndex);
console.log(reg2.exec(str));
console.log(reg2.lastIndex);

console.log(reg2.lastIndex);
console.log(reg2.exec(str));
console.log(reg2.lastIndex);